﻿using System;

class Solution1
{
    static void Main1()
    {
        string[] pleasantnessStrArr = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.None);
        
        int [] pleasantness = new int [pleasantnessStrArr.Length];

        for (int i = 0; i < pleasantnessStrArr.Length; i++)
        {
            pleasantness[i] = int.Parse(pleasantnessStrArr[i]);
        }

        int variaty = int.Parse(Console.ReadLine());


        int indexMin = 0;
        int indexMax = 0;
        int min = pleasantness[0];
        int max = pleasantness[0];
        int index = 1;

        while ((index < pleasantness.Length) && (max - min < variaty))
        {
            if (pleasantness[index] < min)
            {
                min = pleasantness[index];
                indexMin = index;
            }
            else if (pleasantness[index] > max)
            {
                max = pleasantness[index];
                indexMax = index;
            }

            index++;
        }

        if (max - min < variaty)
        {
            Console.WriteLine(pleasantness.Length);
        }
        else
        {
            int smallerIndex;
            int biggerIndex;

            if (indexMin < indexMax)
            {
                smallerIndex = indexMin;
                biggerIndex = indexMax;
            }
            else
            {
                smallerIndex = indexMax;
                biggerIndex = indexMin;
            }

            int count = smallerIndex/2 + smallerIndex%2 + 1;
            smallerIndex = biggerIndex-smallerIndex;
            count += smallerIndex / 2 + smallerIndex % 2;

            Console.WriteLine(count);
        }
    }
}
